#!/bin/sh
# kill tomcat “grep tomcat” 里面的 tomcat 是运行的tomcat 所在文件夹的名字
echo "kill tomcat"
# ps -ef | grep tomcat | grep -v grep | awk '{print $2}' | xargs kill -9
pids=`ps -ef|grep tomcat |grep -v "grep"|grep -v "$0"| awk '{print $2}'`
if [ "$pids" != "" ];then
    for  pid  in   $pids;
    do
        kill -9 $pid
        echo $pid
        echo "\n"
    done
fi

echo "starting tomcat"
/Users/leeyi/workspace/java/apache-tomcat-7.0.73/bin/startup.sh
